import re
from rest_framework import serializers

from api.models.payment import Payrecord
from api.models.product import Porduct, PorductImage
from api.models.stock_record import StockPrice, StockRecord
from api.utils.backends import BucketOperation


class PaymentBodySerializer(serializers.Serializer):
    alipay_url = serializers.CharField(help_text="支付宝支付地址与用户交互", max_length=256)


class PaymentQuerySerializer(serializers.Serializer):
    out_trade_no = serializers.CharField(help_text="支付宝订单号", max_length=256)
    trade_no = serializers.CharField(help_text="支付宝流水号", max_length=256)
    sign = serializers.CharField(help_text="支付宝校验参数", max_length=256)


class PaymentRecordSerializer(serializers.ModelSerializer):
    class Meta:
        model = Payrecord
        fields = ["trade_num"]
